home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************
- *
- * Project Name: Templates
- * File Name: cset.c
- * Author: Rob Neville (IIx)
- * Date: May 18, 1989
- *
- * Description: Template cset function.
- *
- *************************************************************************************
- *
- * Revision History:
- * 5/18/89 - Original version by Rob Neville (IIx)
- * 6/26/89 - Reved for CTB b2
- *
- ************************************************************************************/
-
- #include "CMTool.h"
-
- pascal long CSET(pSetup,msg,p1,p2,p3)
- CMSetupPtr pSetup;
- short msg;
- long p1,p2,p3;
- {
- long theErr = TNoErr;
- long ToolDoPreflight();
- long ToolDoFilter();
- long ToolDoItem();
- long ToolDoSetup();
- long ToolDoCleanup();
-
- switch (msg)
- {
- case TSpreflightMsg:
- theErr = ToolDoPreflight(pSetup);
- break;
- case TSsetupMsg:
- ToolDoSetup(pSetup);
- break;
- case TSitemMsg:
- ToolDoItem(pSetup,p1);
- break;
- case TSfilterMsg:
- theErr = ToolDoFilter(pSetup,p1,p2);
- break;
- case TScleanupMsg:
- ToolDoCleanup(pSetup);
- break;
- }
- return (theErr);
- #pragma unused (p3)
- }
-
-
- ToolDoSetup(pSetup)
- CMSetupPtr pSetup;
- {
- DialogPtr theDialog;
- ConfigPtr pConfig;
- short theKind;
- Handle theHandle;
- Rect theRect;
- short count;
-
- pConfig = (ConfigPtr)pSetup->theConfig;
- theDialog = pSetup->theDialog;
- count = pSetup->count - 1;
-
- GetDItem(theDialog,count + ByronItem,&theKind,&theHandle,&theRect);
- SetCtlValue( (ControlHandle)theHandle,pConfig->param1 ? 1 : 0);
- GetDItem(theDialog,count + RobItem,&theKind,&theHandle,&theRect);
- SetCtlValue((ControlHandle)theHandle,pConfig->param2 ? 1 : 0);
- }
-
- ToolDoItem(setupP, itemPtr)
- CMSetupPtr setupP;
- short *itemPtr;
- {
- short theItem;
- short theKind;
- Handle theHandle;
- Rect theRect;
- ConfigPtr pConfig;
- DialogPtr theDialog;
- long first;
- short theValue;
-
- pConfig = (ConfigPtr)setupP->theConfig;
- theDialog = setupP->theDialog;
- first = setupP->count - 1;
- theItem = *itemPtr;
- GetDItem(theDialog, theItem, &theKind, &theHandle, &theRect);
- theItem = *itemPtr - first;
- switch (theItem)
- {
- case ByronItem:
- theValue = GetCtlValue((ControlHandle)theHandle);
- SetCtlValue((ControlHandle)theHandle, theValue ^ 1);
- pConfig->param1 = theValue ^ 1;
- break;
- case RobItem:
- theValue = GetCtlValue((ControlHandle)theHandle);
- SetCtlValue((ControlHandle)theHandle, theValue ^ 1);
- pConfig->param2 = theValue ^ 1;
- break;
- default:
- break;
- }
- }
-
- long ToolDoFilter(setupP, theEvent, itemPtr)
- CMSetupPtr setupP;
- EventRecord *theEvent;
- short *itemPtr;
- {
- #pragma unused (setupP)
- #pragma unused (theEvent)
- #pragma unused (itemPtr)
- return(0); /* I don't have any special items just check boxes */
- }
-
- ToolDoCleanup(setupP)
- CMSetupPtr setupP;
- {
- #pragma unused (setupP) /* I don't do anything */
- }
-
-
- long ToolDoPreflight(setupP)
- CMSetupPtr setupP;
- {
- short id;
- Handle theHandle;
-
- id = CRMLocalToRealID(classCM,(*setupP).procID,'DITL',1);
- if (id == -1)
- return (nil);
- theHandle = GetResource('DITL',id);
- if (theHandle != nil)
- DetachResource(theHandle);
- return ((long)theHandle);
- }